package com.cqie.controller.user;

import com.cqie.dto.user.PatientInfoDto;
import com.cqie.service.IPatientInfoService;
import com.cqie.util.ResultTemplate;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 不吃海鲜
 * @since 2024-11-27
 */


@Tag(name = "患者信息Controller", description = "描述：患者信息接口")
@RestController
@RequestMapping({"/api/v1.0/patientInfo", "/api/v1/patientInfo"})
public class PatientInfoController {

    private final IPatientInfoService patientInfoService;

    public PatientInfoController(IPatientInfoService patientInfoService) {
        this.patientInfoService = patientInfoService;
    }

    @Operation(summary = "获取患者个人信息")
    @GetMapping("getPatientInfo")
    public ResultTemplate<PatientInfoDto> getPatientInfo(){
        return ResultTemplate.Success(patientInfoService.getPatientInfo());
    }

    @Operation(summary = "新增 / 更新 患者个人信息")
    @PostMapping("savePatientInfo")
    public ResultTemplate<Boolean> savePatientInfo(@RequestBody PatientInfoDto patientInfoDto){
        return ResultTemplate.Success(patientInfoService.savePatientInfo(patientInfoDto));
    }

}
